Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add handle for resolveExternalUri #5624

Merged
merged 19 commits into from
Oct 14, 2022
Merged

fix: add handle for resolveExternalUri #5624

merged 19 commits into from
Oct 14, 2022

Conversation

jsjoeio
Copy link
Contributor

@jsjoeio jsjoeio commented Oct 6, 2022

This PR fixes asExternalUri to use code-server's built-in proxy or VSCODE_PROXY_URI if it's been set.

Todos

  • handle path-based proxies
  • add e2e test for it
  • add e2e test for VSCODE_PROXY_URI
  • support VSCODE_PROXY_URI

Fixes #1936

patches/proxy-uri.diff Outdated Show resolved Hide resolved
patches/proxy-uri.diff Outdated Show resolved Hide resolved
patches/proxy-uri.diff Outdated Show resolved Hide resolved
@jsjoeio jsjoeio self-assigned this Oct 6, 2022
patches/proxy-uri.diff Outdated Show resolved Hide resolved
patches/proxy-uri.diff Outdated Show resolved Hide resolved
@code-asher
Copy link
Member

code-asher commented Oct 6, 2022

Patch patches/proxy-uri.diff does not apply (enforce with -f)

Might be easiest to force-apply it then resolve the conflicts and refresh it! It could be a conflict with base-path.diff.

@jsjoeio jsjoeio requested a review from code-asher October 6, 2022 18:49
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Oct 6, 2022

Oops..looks like proxyEndpointTemplate adds /proxy/port for you.

image

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

patches/proxy-uri.diff Outdated Show resolved Hide resolved
patches/proxy-uri.diff Outdated Show resolved Hide resolved
@jsjoeio jsjoeio temporarily deployed to npm October 6, 2022 18:56 Inactive
@github-actions
Copy link

github-actions bot commented Oct 6, 2022

✨ code-server dev build published to npm for PR #5624!

  • Last publish status: success
  • Commit: bfe91fc

To install in a local project, run:

npm install @coder/code-server-pr@5624

To install globally, run:

npm install -g @coder/code-server-pr@5624

@codecov
Copy link

codecov bot commented Oct 6, 2022

Codecov Report

Merging #5624 (bfe91fc) into main (714afe0) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5624   +/-   ##
=======================================
  Coverage   72.61%   72.61%           
=======================================
  Files          30       30           
  Lines        1680     1680           
  Branches      368      368           
=======================================
  Hits         1220     1220           
  Misses        397      397           
  Partials       63       63           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 714afe0...bfe91fc. Read the comment docs.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Oct 6, 2022

Looks good now! (ignore expected, hard-coded)

image

Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me! Do you want an approval now to merge or are you going to add the domain-based proxy in this same PR so I should approve after that is done?

@jsjoeio jsjoeio temporarily deployed to npm October 6, 2022 19:10 Inactive
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Oct 6, 2022

are you going to add the domain-based proxy in this same PR so I should approve after that is done?

I'll work on that here then mark PR ready when all is said and done. Thanks for the early review!

@jsjoeio jsjoeio force-pushed the jsjoeio/external-uri branch from 39be51a to 9681169 Compare October 7, 2022 20:24
@jsjoeio jsjoeio temporarily deployed to npm October 7, 2022 20:26 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 7, 2022 21:58 Inactive
@jsjoeio jsjoeio marked this pull request as ready for review October 7, 2022 22:20
@jsjoeio jsjoeio requested a review from a team as a code owner October 7, 2022 22:20
@jsjoeio jsjoeio requested a review from code-asher October 7, 2022 22:20
@jsjoeio jsjoeio temporarily deployed to npm October 7, 2022 22:24 Inactive
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Oct 10, 2022

It appears the display language e2e test is failing. I'm going to see if I can reproduce locally.

@jsjoeio jsjoeio temporarily deployed to npm October 10, 2022 21:08 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 10, 2022 21:21 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 10, 2022 21:25 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 10, 2022 21:49 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 10, 2022 22:07 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 10, 2022 22:21 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 11, 2022 01:39 Inactive
patches/service-worker.diff Show resolved Hide resolved
Comment on lines 32 to 37
"__metadata": {
"id": "47e020a1-33db-4cc0-a1b4-42f97781749a",
"publisherDisplayName": "MS-CEINTL",
"publisherId": "0b0882c3-aee3-4d7c-b5f9-872f9be0a115",
"isPreReleaseVersion": false
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed VS Code added this after running the test so I decided to commit it.

@@ -327,7 +327,7 @@ export class CodeServerPage {
const selector = "text=test extension loaded"
this.codeServer.logger.debug("Waiting for test extension to load...")

await this.page.waitForSelector(selector)
await this.page.waitForSelector(selector, { timeout: 5000 })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gonna drop this change

@@ -8,6 +8,7 @@ import path from "path"
// yarn test:e2e --workers 1 # Run with one worker
// yarn test:e2e --project Chromium # Only run on Chromium
// yarn test:e2e --grep login # Run tests matching "login"
// PWDEBUG=1 yarn test:e2e # Run Playwright inspector
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saves time from having to look this up each time 😂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100% lol same reason I added the other comments I am always forgetting the flags

@jsjoeio jsjoeio force-pushed the jsjoeio/external-uri branch from d7ead89 to fb7bcb8 Compare October 13, 2022 17:52
@jsjoeio
Copy link
Contributor Author

jsjoeio commented Oct 13, 2022

@code-asher ready for another review!

@jsjoeio jsjoeio temporarily deployed to npm October 13, 2022 18:06 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 13, 2022 20:18 Inactive
@jsjoeio jsjoeio temporarily deployed to npm October 13, 2022 20:30 Inactive
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done! I only have a comment about the added metadata.

@jsjoeio jsjoeio enabled auto-merge (squash) October 13, 2022 22:20
@jsjoeio jsjoeio temporarily deployed to npm October 13, 2022 22:22 Inactive
@ericzhucode
Copy link

ericzhucode commented Feb 15, 2023

I found there's a conflict between this feature and url displayed in open external uri dialog.
If you open an external uri for the first time then the domain of it will be resolved to cache in map data structure.
Like https://www.w3schools.com/c/c_structs.php
image

For the next time if you open a different uri with the same domain
Like https://github.com/coder/code-server/issues
it will be resolved as the last uri which has been cached.
image

The uri displayed here is not correct

Before there's no resolvers registered by default so external uri is not resolved but after this feature added, cache will take effect
image

Hope there's a solutaion for this. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

asExternalUri doesn't work
4 participants